package eclipse.lib.graphics.shaders;
import java.util.*;

/**
 * The CircleShader class functions as a shader for a circle object
 */
public class GLCircleShader 
{
	private List<GLColor> colColor;
	private int colTotal = 0;
	/**
	 * Creates a circle shader with an array of colors
	 * @param Color Array of colors to create the circle class.
	 */
	public GLCircleShader(GLColor[] Color)
	{
		colColor = new ArrayList<GLColor>(Color.length);
		for(int i = 0; i < Color.length; i++)
		{
			colColor.add(Color[i]);
			colTotal++;
		}
	}
	/**
	 * Creates a circle shader with a single color and a specified number of segments
	 * @param Color Color of the shader
	 * @param segments Segments to create
	 */
	public GLCircleShader(GLColor Color, int segments)
	{
		colColor = new ArrayList<GLColor>(segments);
		for(int i = 0; i < segments; i++)
		{
			colColor.add(Color);
			colTotal++;
		}
	}
	/**
	 * Sets a segment to a specific color
	 * @param sector Segment of the circle shader
	 * @param Color Color to set to
	 */
	public void setSector(int sector, GLColor Color)
	{
		if(sector <= colTotal && sector >= 0)
			colColor.set(sector, Color);
	}
	/**
	 * Returns the color of a segment
	 * @param sector Segment of the circle shader
	 */
	public GLColor getSector(int sector)
	{
		if(sector <= colTotal && sector >= 0)
			return colColor.get(sector);
		return null;
	}
}
